<%= form_for @changeset, Routes.codebase_path(@conn, :update, @repo.owner_login, @repo, @revision, @tree_path), [id: "blob-form", as: :commit, method: :put], fn f -> %>
  <nav class="level">
    <div class="level-left">
      <div class="level-item">
        <%= branch_select_live(@conn, @repo, @revision, @tree_path) %>
      </div>
      <div class="level-item">
        <%= render "_breadcrumb.html", assigns %>
      </div>
      <div class="level-item blob-name-level-item">
        <div class="field blob-name-field">
          <div class="control">
            <%= text_input f, :name, class: "input" %>
          </div>
          <%= error_tag f, :name %>
        </div>
      </div>
    </div>
    <div class="level-right">
      <div class="level-item">
        <a href="<%= Routes.codebase_path(@conn, :blob, @repo.owner_login, @repo.name, @revision, @tree_path) %>" class="button">Cancel</a>
      </div>
    </div>
  </nav>

  <div class="card blob-edit">
    <div class="tabs is-boxed">
      <ul>
        <li class="is-active">
          <a>
            <span class="icon is-small"><i class="fa fa-pen" aria-hidden="true"></i></span>
            <span>Edit file</span>
          </a>
        </li>
        <li>
          <a>
            <span class="icon is-small"><i class="fa fa-eye" aria-hidden="true"></i></span>
            <span>Preview</span>
          </a>
        </li>
      </ul>
    </div>

    <div class="field">
      <div class="control">
        <%= textarea f, :content, class: "textarea is-white code", rows: 20 %>
      </div>
      <%= error_tag f, :content %>
    </div>
  </div>

  <div class="box">
    <h2 class="subtitle">Commit changes</h2>
    <div class="field">
      <div class="control">
        <%= text_input f, :message, class: "input", placeholder: "Update #{input_value(f, :name)}" %>
      </div>
      <%= error_tag f, :message %>
    </div>

    <div class="field">
      <div class="control">
        <%= textarea f, :description, class: "textarea", placeholder: "Add an optional extended message..." %>
      </div>
      <%= error_tag f, :description %>
    </div>

    <%= hidden_input f, :branch %>

    <p>Commit directly to <span class="tag is-small"><%= input_value(f, :branch) %></span> branch.</p>

    <hr />

    <div class="field">
      <%= submit "Commit changes", class: "button is-success" %>
    </div>
  </div>
<% end %>
